package com.arraylist;

import com.sun.tools.corba.se.idl.StringGen;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ArrayListFoot {
    public static void main(String[] args) {
        List<String> foot = new ArrayList<>();
        String[] arr = {"科特迪瓦","阿根廷","澳大利亚","塞尔维亚","荷兰","尼日利亚","日本","美国","中国","新西兰","巴西","比利时","韩国","喀麦隆","洪都拉斯","意大利"};
        for (int i = 0; i < arr.length; i++) {
            foot.add(arr[i]);
        }
        Collections.shuffle(foot);  //打乱顺序

        ArrayList<String> a = new ArrayList<>();
        ArrayList<String> b = new ArrayList<>();
        ArrayList<String> c = new ArrayList<>();
        ArrayList<String> d = new ArrayList<>();

        for (int i = 0; i < foot.size(); i++) {
            if (i % 4 == 0) {
                a.add(foot.get(i));
            } else if (i % 4 == 1) {
                b.add(foot.get(i));
            } else if (i % 4 == 2) {
                c.add(foot.get(i));
            } else if (i % 4 == 3) {
                d.add(foot.get(i));
            }
        }
        System.out.println("A组分组国家" + a);
        System.out.println("B组分组国家" + b);
        System.out.println("C组分组国家" + c);
        System.out.println("D组分组国家" + d);
    }
}
